package day5;



import org.junit.Test;

public class StringDemo {
    @Test
    public void test1() {
        // "abc"字符串常量，也是一个对象
        String str1 = "abc";
        String str2 = new String("abc");
        String str3 = "abc";
        //==比较的是地址值
        System.out.println(str1 == str2);// false
        System.out.println(str1 == str3);// true
        System.out.println(str2 == str3);// false
        //equals()比较字符串的内容是不是相等
        System.out.println(str1.equals(str2));//true
        System.out.println(str1.equals(str3));//true
        System.out.println(str2.equals(str3));//true
    }
}
